#include<set>
#include<iostream>
using namespace std;
int main(){
	int n,m,b;
	set<int>a;
	cin>>n>>m;
	n+=m;
	while(n--){cin>>b;a.insert(b);}
	for(set<int>::iterator it=a.begin();it!=a.end();++it)
		cout<<(*it)<<" ";
	return 0;
}